﻿using Compass.Wasm.Shared;
using Compass.Wasm.Shared.Purchases;
using Compass.Wasm.Shared.Wms;
using System.Collections.Generic;

namespace Compass.Wpf.ApiServices.Purchases;
public interface INavItemService:IBaseService<NavItemDto>
{
    Task<ApiResponse<NavItemDto>> GetSingleByNumberAsync(string number);
    Task<ApiResponse<List<NavItemDto>>> GetAllByFsAndShareAsync();
}
public class NavItemService:BaseService<NavItemDto>,INavItemService
{
    private readonly HttpRestClient _client;
    private const string ServiceName = "NavItem";
    public NavItemService(HttpRestClient client) : base(client, ServiceName)
    {
        _client = client;
    }


    #region 扩展查询
    public async Task<ApiResponse<NavItemDto>> GetSingleByNumberAsync(string number)
    {
        var request = new BaseRequest
        {
            Method = RestSharp.Method.Get,
            Route = $"api/{ServiceName}/Number?number={number}"
        };
        return await _client.ExecuteAsync<NavItemDto>(request);
    }

    public async Task<ApiResponse<List<NavItemDto>>> GetAllByFsAndShareAsync()
    {
        var request = new BaseRequest
        {
            Method = RestSharp.Method.Get,
            Route = $"api/{ServiceName}/FsAndShare"
        };
        return await _client.ExecuteAsync<List<NavItemDto>>(request);
    }

    #endregion
}